/* 
 * File:   Player.h
 * Copyright (C) 2009
 *		Sergio Padrino Recio (PadrinatoR)
 *
 * Created on 19 de marzo de 2009, 0:13
 *
 * This file is part of BombProject.
 *
 * BombProject is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * BombProject is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with BombProject.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _PLAYER_H
#define	_PLAYER_H

#include "AnimatedSprite.h"
#include "GameControl.h"

class Player : public AnimatedSprite {
public:
    enum PlayerDirection {DIRECTION_UP, DIRECTION_DOWN, DIRECTION_RIGHT, DIRECTION_LEFT};

    Player();
    ~Player();

    GameControl* getGameControl() { return mGameControl; }
    void setGameControl(GameControl* game_control) { mGameControl = game_control; }
	
    //Position functions
	/*int getX() { return mX; };
	int getY() { return mY; };*/
	int getTileX();
	int getTileY();

	//Movement functions
	void moveUp();
	void moveDown();
	void moveLeft();
	void moveRight();
        void turnUp();
        void turnDown();
        void turnLeft();
        void turnRight();

	//Speed management
	int getSpeed() { return mSpeed; };
	void increaseSpeed();
	void decreaseSpeed();
	void setMinSpeed() { mSpeed = 1; };

	//Bombs management
	int getMaxBombs() { return mMaxBombs; };
	bool canPutBombs() { return mNumBombs < mMaxBombs; }
	void increaseMaxBombs();
	void decreaseMaxBombs();
	void setMinMaxBombs() { mMaxBombs = 1; };
	void putBomb() { mNumBombs++; };
	void notifyBombExploded() { mNumBombs--; };
	//TODO: Change bomb type...

	//Power management
	int getPower() { return mPower; };
	void increasePower() { /*if(mPower < MAX_POWER) mPower++;*/ };
	void decreasePower() { if(mPower > 1) mPower--; };
	void setMaxPower() { /*mPower = MAX_POWER;*/ };
	void setMinPower() { mPower = 1; };

	//Misc
	void updateInput();
        void update();

private:
	//int mX, mY;
	int mSpeed, mSpeedX, mSpeedY;
	int mMaxBombs, mNumBombs;
	int mPower;
        PlayerDirection mDirection;
	GameControl* mGameControl;

};

#endif	/* _PLAYER_H */

